Say that the user also had a check of $25.10 to record. What must the user do now?
The user must run the program again, and enter the balance of $1500.32, the transaction type 'C', and the check amount $25.10. The dialog looks like:
What is the starting balance ?1500.32 Type a 'D' for a deposit or a 'C' for a check ? C What is the check amount ? 25.10 The new balance is 1475.22
It is a nuisance to start the program from scratch for every transaction. It would be nice if the program kept running for as many transactions as the user wanted to record. The program should keep the balance current so that the only number the user has to enter is the amount for each transaction.
Here is an example of what we would like:
What is the starting balance ? 500.32 Type a 'D' for a deposit or 'C' for a check ? D What is the deposit amount ? 1000 The new balance is 1500.32 Do you want to quit? Y or N ? N Type a 'D' for a deposit or 'C' for a check ? C What is the check amount ? 25.10 The new balance is 1475.22 Do you want to quit? Y or N ? N Type a 'D' for a deposit or 'C' for a check ? C What is the check amount ? 100 The new balance is 1375.22 Do you want to quit? Y or N ? Y Bye
What control structure
can be used so that the program works with as many transactions as needed per run?